<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.17"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <title>QuEST: tutorial_example.c File Reference</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></script>
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="style.css" rel="stylesheet" type="text/css"/>
        <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
        <script type="text/javascript" src="jquery.smartmenus.js"></script>
        <!-- SmartMenus jQuery Bootstrap Addon -->
        <script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
        <!-- SmartMenus jQuery plugin -->
    </head>
    <body>
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand"><img alt="Logo" src="logo.png"/></a>
                    <a class="navbar-brand"><b>QuEST</b> v3.0.1<br>The Quantum Exact Simulation Toolkit</a>
                </div>
            </div>
        </nav>
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel " style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d522931ffa1371640980b621734a4381.html">Users</a></li><li class="navelem"><a class="el" href="dir_70834f0dcd10de01d2e35ab402a2238e.html">tysonjones</a></li><li class="navelem"><a class="el" href="dir_1957401ef452be7528010ba0f4832a45.html">Desktop</a></li><li class="navelem"><a class="el" href="dir_dee4414d5d72b49a9429e079789ffd08.html">GithubRepos</a></li><li class="navelem"><a class="el" href="dir_a89b43d59316bb5045aa22bb53a67d29.html">QuEST</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">tutorial_example.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;stdio.h&gt;</code><br />
<code>#include &quot;<a class="el" href="QuEST_8h_source.html">QuEST.h</a>&quot;</code><br />
</div>
<p><a href="tutorial__example_8c_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a32b4528424672580be0dc0e6cd8544c3"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="tutorial__example_8c.html#a32b4528424672580be0dc0e6cd8544c3">main</a> (int narg, char *varg[])</td></tr>
<tr class="separator:a32b4528424672580be0dc0e6cd8544c3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A demo of QuEST</p>
<dl class="section author"><dt>Author</dt><dd>Ania Brown </dd>
<dd>
Tyson Jones </dd></dl>

<p class="definition">Definition in file <a class="el" href="tutorial__example_8c_source.html">tutorial_example.c</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a32b4528424672580be0dc0e6cd8544c3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a32b4528424672580be0dc0e6cd8544c3">&#9670;&nbsp;</a></span>main()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int main </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>narg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>varg</em>[]&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="tutorial__example_8c_source.html#l00011">11</a> of file <a class="el" href="tutorial__example_8c_source.html">tutorial_example.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;                                  {</div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160; </div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160; </div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160; </div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;    <span class="comment">/*</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment">     * PREPARE QuEST environment</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment">     * (Required only once per program)</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment">     */</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160; </div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;    <a class="code" href="structQuESTEnv.html">QuESTEnv</a> env = <a class="code" href="group__type.html#ga8ba2c3388dd64d9348c3b091852d36d4">createQuESTEnv</a>();</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160; </div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;    printf(<span class="stringliteral">&quot;-------------------------------------------------------\n&quot;</span>);</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;    printf(<span class="stringliteral">&quot;Running QuEST tutorial:\n\t Basic circuit involving a system of 3 qubits.\n&quot;</span>);</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;    printf(<span class="stringliteral">&quot;-------------------------------------------------------\n&quot;</span>);</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160; </div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160; </div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160; </div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;    <span class="comment">/*</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="comment">     * PREPARE QUBIT SYSTEM</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="comment">     */</span></div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160; </div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    <a class="code" href="structQureg.html">Qureg</a> qubits = <a class="code" href="group__type.html#ga3392816c0643414165c2f5caeec17df0">createQureg</a>(3, env);</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;    <a class="code" href="group__init.html#ga2f049055d4a51d0ea4d1a43b5234dedb">initZeroState</a>(qubits);</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160; </div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160; </div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160; </div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    <span class="comment">/*</span></div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="comment">     * REPORT SYSTEM AND ENVIRONMENT</span></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="comment">     */</span></div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;    printf(<span class="stringliteral">&quot;\nThis is our environment:\n&quot;</span>);</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    <a class="code" href="group__debug.html#ga97d96af7c7ea7b31e32cbe3b25377e09">reportQuregParams</a>(qubits);</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    <a class="code" href="group__debug.html#gaf8a14ae79c3fb2c0b5f6255cc37bebf9">reportQuESTEnv</a>(env);</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160; </div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160; </div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160; </div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;    <span class="comment">/*</span></div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;<span class="comment">     * APPLY CIRCUIT</span></div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="comment">     */</span></div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160; </div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;    <a class="code" href="group__unitary.html#ga2f3bec8d06e7bf7314c581a5b837641f">hadamard</a>(qubits, 0);</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;    <a class="code" href="group__unitary.html#gadf4927a3d5dd8cd6d7400f2e810b4f05">controlledNot</a>(qubits, 0, 1);</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    <a class="code" href="group__unitary.html#ga680f90d42e56950f40d11d695596a363">rotateY</a>(qubits, 2, .1);</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160; </div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;    <span class="keywordtype">int</span> targs[] = {0,1,2};</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;    <a class="code" href="group__unitary.html#gad76781842af56821ed4e223bd776f057">multiControlledPhaseFlip</a>(qubits, targs, 3);</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160; </div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    <a class="code" href="structComplexMatrix2.html">ComplexMatrix2</a> u = {</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;        .<a class="code" href="structComplexMatrix2.html#a3ea98d545b67a190ee6abe936c72076f">real</a>={{.5,.5},{.5,.5}},</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;        .imag={{.5,-.5},{-.5,.5}}</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    };</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;    <a class="code" href="group__unitary.html#ga5a117f81298e8ed894d964198e737757">unitary</a>(qubits, 0, u);</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160; </div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    <a class="code" href="structComplex.html">Complex</a> a, b;</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    a.<a class="code" href="structComplex.html#ab5b2e2eca02131fc74b289a83636cbe3">real</a> = .5; a.<a class="code" href="structComplex.html#a84f5439aad0ef495efdd3b4c1c02d27e">imag</a> =  .5;</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    b.<a class="code" href="structComplex.html#ab5b2e2eca02131fc74b289a83636cbe3">real</a> = .5; b.<a class="code" href="structComplex.html#a84f5439aad0ef495efdd3b4c1c02d27e">imag</a> = -.5;</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    <a class="code" href="group__unitary.html#ga0cbd92af48fe641522e62eea1a76a7c3">compactUnitary</a>(qubits, 1, a, b);</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160; </div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    <a class="code" href="structVector.html">Vector</a> v;</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;    v.<a class="code" href="structVector.html#a0d0459a5b731ac5fb3dff2c6134e6e88">x</a> = 1; v.<a class="code" href="structVector.html#abc3cfc6c8e297b1153a373d84b981e6b">y</a> = 0; v.<a class="code" href="structVector.html#ab33976d8fda2e44b770f71269d698a25">z</a> = 0;</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;    <a class="code" href="group__unitary.html#gac5c485fe330636966effc0642ba2bd99">rotateAroundAxis</a>(qubits, 2, 3.14/2, v);</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160; </div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;    <a class="code" href="group__unitary.html#gaa854e4b76cfd4000a32c06c990960bd9">controlledCompactUnitary</a>(qubits, 0, 1, a, b);</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160; </div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;    <span class="keywordtype">int</span> ctrls[] = {0,1};</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    <a class="code" href="group__unitary.html#ga18c44cb3b947147951590dea2f6b25f7">multiControlledUnitary</a>(qubits, ctrls, 2, 2, u);</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    </div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    <a class="code" href="structComplexMatrixN.html">ComplexMatrixN</a> toff = <a class="code" href="group__type.html#ga815103261fb22ea9690e1427571df00e">createComplexMatrixN</a>(3);</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    toff.<a class="code" href="structComplexMatrixN.html#a446e8a077597e4f76049d547df0c9738">real</a>[6][7] = 1;</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    toff.<a class="code" href="structComplexMatrixN.html#a446e8a077597e4f76049d547df0c9738">real</a>[7][6] = 1;</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;6; i++)</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;        toff.<a class="code" href="structComplexMatrixN.html#a446e8a077597e4f76049d547df0c9738">real</a>[i][i] = 1;</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;    <a class="code" href="group__unitary.html#gab5828a9f0518951451d9fec9370199ae">multiQubitUnitary</a>(qubits, targs, 3, toff);</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;    </div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    </div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;    </div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    <span class="comment">/*</span></div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;<span class="comment">     * STUDY QUANTUM STATE</span></div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;<span class="comment">     */</span></div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160; </div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;    printf(<span class="stringliteral">&quot;\nCircuit output:\n&quot;</span>);</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160; </div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> prob;</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    prob = <a class="code" href="group__calc.html#ga4a14d22379d399760b0cfc5c8053589b">getProbAmp</a>(qubits, 7);</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;    printf(<span class="stringliteral">&quot;Probability amplitude of |111&gt;: %g\n&quot;</span>, prob);</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160; </div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;    prob = <a class="code" href="group__calc.html#ga2a0fbd65f42d35dcd5ae966c48826920">calcProbOfOutcome</a>(qubits, 2, 1);</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    printf(<span class="stringliteral">&quot;Probability of qubit 2 being in state 1: %g\n&quot;</span>, prob);</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160; </div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;    <span class="keywordtype">int</span> outcome = <a class="code" href="group__normgate.html#ga2a3794103125f1e3cfa103f8b1963656">measure</a>(qubits, 0);</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    printf(<span class="stringliteral">&quot;Qubit 0 was measured in state %d\n&quot;</span>, outcome);</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160; </div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;    outcome = <a class="code" href="group__normgate.html#gae192ac0759e46c7b20a7182020155240">measureWithStats</a>(qubits, 2, &amp;prob);</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;    printf(<span class="stringliteral">&quot;Qubit 2 collapsed to %d with probability %g\n&quot;</span>, outcome, prob);</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160; </div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160; </div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160; </div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    <span class="comment">/*</span></div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;<span class="comment">     * FREE MEMORY</span></div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;<span class="comment">     */</span></div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160; </div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;    <a class="code" href="group__type.html#ga8e1e6ad3254892edc2ee08712ea9d692">destroyQureg</a>(qubits, env); </div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    <a class="code" href="group__type.html#ga9df2f3d86be4a6e9aad481665e5e6753">destroyComplexMatrixN</a>(toff);</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160; </div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160; </div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160; </div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;    <span class="comment">/*</span></div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;<span class="comment">     * CLOSE QUEST ENVIRONMET</span></div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;<span class="comment">     * (Required once at end of program)</span></div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;<span class="comment">     */</span></div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    <a class="code" href="group__type.html#gaeff624226629d7063a8a776958a4f991">destroyQuESTEnv</a>(env);</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;    <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;}</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST_8c_source.html#l00888">calcProbOfOutcome()</a>, <a class="el" href="QuEST_8c_source.html#l00403">compactUnitary()</a>, <a class="el" href="QuEST_8c_source.html#l00416">controlledCompactUnitary()</a>, <a class="el" href="QuEST_8c_source.html#l00523">controlledNot()</a>, <a class="el" href="QuEST_8c_source.html#l01043">createComplexMatrixN()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00129">createQuESTEnv()</a>, <a class="el" href="QuEST_8c_source.html#l00034">createQureg()</a>, <a class="el" href="QuEST_8c_source.html#l01064">destroyComplexMatrixN()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00172">destroyQuESTEnv()</a>, <a class="el" href="QuEST_8c_source.html#l00075">destroyQureg()</a>, <a class="el" href="QuEST_8c_source.html#l00690">getProbAmp()</a>, <a class="el" href="QuEST_8c_source.html#l00175">hadamard()</a>, <a class="el" href="QuEST_8h_source.html#l00106">Complex::imag</a>, <a class="el" href="QuEST_8c_source.html#l00111">initZeroState()</a>, <a class="el" href="QuEST_8c_source.html#l00756">measure()</a>, <a class="el" href="QuEST_8c_source.html#l00743">measureWithStats()</a>, <a class="el" href="QuEST_8c_source.html#l00559">multiControlledPhaseFlip()</a>, <a class="el" href="QuEST_8c_source.html#l00372">multiControlledUnitary()</a>, <a class="el" href="QuEST_8c_source.html#l00295">multiQubitUnitary()</a>, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>, <a class="el" href="QuEST_8h_source.html#l00105">Complex::real</a>, <a class="el" href="QuEST_8h_source.html#l00116">ComplexMatrix2::real</a>, <a class="el" href="QuEST_8h_source.html#l00139">ComplexMatrixN::real</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00179">reportQuESTEnv()</a>, <a class="el" href="QuEST__common_8c_source.html#l00233">reportQuregParams()</a>, <a class="el" href="QuEST_8c_source.html#l00573">rotateAroundAxis()</a>, <a class="el" href="QuEST_8c_source.html#l00197">rotateY()</a>, <a class="el" href="QuEST_8c_source.html#l00347">unitary()</a>, <a class="el" href="QuEST_8h_source.html#l00150">Vector::x</a>, <a class="el" href="QuEST_8h_source.html#l00150">Vector::y</a>, and <a class="el" href="QuEST_8h_source.html#l00150">Vector::z</a>.</p>

</div>
</div>
</div><!-- contents -->
<div class="ttc" id="agroup__calc_html_ga4a14d22379d399760b0cfc5c8053589b"><div class="ttname"><a href="group__calc.html#ga4a14d22379d399760b0cfc5c8053589b">getProbAmp</a></div><div class="ttdeci">qreal getProbAmp(Qureg qureg, long long int index)</div><div class="ttdoc">Get the probability of a state-vector at an index in the full state vector.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00690">QuEST.c:690</a></div></div>
<div class="ttc" id="astructVector_html"><div class="ttname"><a href="structVector.html">Vector</a></div><div class="ttdoc">Represents a 3-vector of real numbers.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00148">QuEST.h:148</a></div></div>
<div class="ttc" id="agroup__type_html_gaeff624226629d7063a8a776958a4f991"><div class="ttname"><a href="group__type.html#gaeff624226629d7063a8a776958a4f991">destroyQuESTEnv</a></div><div class="ttdeci">void destroyQuESTEnv(QuESTEnv env)</div><div class="ttdoc">Destroy the QuEST environment.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00172">QuEST_cpu_distributed.c:172</a></div></div>
<div class="ttc" id="agroup__debug_html_ga97d96af7c7ea7b31e32cbe3b25377e09"><div class="ttname"><a href="group__debug.html#ga97d96af7c7ea7b31e32cbe3b25377e09">reportQuregParams</a></div><div class="ttdeci">void reportQuregParams(Qureg qureg)</div><div class="ttdoc">Report metainformation about a set of qubits: number of qubits, number of probability amplitudes.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00233">QuEST_common.c:233</a></div></div>
<div class="ttc" id="agroup__type_html_ga9df2f3d86be4a6e9aad481665e5e6753"><div class="ttname"><a href="group__type.html#ga9df2f3d86be4a6e9aad481665e5e6753">destroyComplexMatrixN</a></div><div class="ttdeci">void destroyComplexMatrixN(ComplexMatrixN m)</div><div class="ttdoc">Destroy a ComplexMatrixN instance created with createComplexMatrixN()</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01064">QuEST.c:1064</a></div></div>
<div class="ttc" id="agroup__type_html_ga815103261fb22ea9690e1427571df00e"><div class="ttname"><a href="group__type.html#ga815103261fb22ea9690e1427571df00e">createComplexMatrixN</a></div><div class="ttdeci">ComplexMatrixN createComplexMatrixN(int numQubits)</div><div class="ttdoc">Create (dynamically) a square complex matrix which can be passed to the multi-qubit general unitary f...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01043">QuEST.c:1043</a></div></div>
<div class="ttc" id="astructVector_html_ab33976d8fda2e44b770f71269d698a25"><div class="ttname"><a href="structVector.html#ab33976d8fda2e44b770f71269d698a25">Vector::z</a></div><div class="ttdeci">qreal z</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00150">QuEST.h:150</a></div></div>
<div class="ttc" id="agroup__normgate_html_ga2a3794103125f1e3cfa103f8b1963656"><div class="ttname"><a href="group__normgate.html#ga2a3794103125f1e3cfa103f8b1963656">measure</a></div><div class="ttdeci">int measure(Qureg qureg, int measureQubit)</div><div class="ttdoc">Measures a single qubit, collapsing it randomly to 0 or 1.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00756">QuEST.c:756</a></div></div>
<div class="ttc" id="astructQuESTEnv_html"><div class="ttname"><a href="structQuESTEnv.html">QuESTEnv</a></div><div class="ttdoc">Information about the environment the program is running in.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00199">QuEST.h:199</a></div></div>
<div class="ttc" id="astructComplexMatrixN_html"><div class="ttname"><a href="structComplexMatrixN.html">ComplexMatrixN</a></div><div class="ttdoc">Represents a general 2^N by 2^N matrix of complex numbers.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00136">QuEST.h:136</a></div></div>
<div class="ttc" id="agroup__type_html_ga7740e349b4f8bae6451547680f0ce2d6"><div class="ttname"><a href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a></div><div class="ttdeci">#define qreal</div></div>
<div class="ttc" id="agroup__unitary_html_ga18c44cb3b947147951590dea2f6b25f7"><div class="ttname"><a href="group__unitary.html#ga18c44cb3b947147951590dea2f6b25f7">multiControlledUnitary</a></div><div class="ttdeci">void multiControlledUnitary(Qureg qureg, int *controlQubits, const int numControlQubits, const int targetQubit, ComplexMatrix2 u)</div><div class="ttdoc">Apply a general multiple-control single-target unitary, which can include a global phase factor.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00372">QuEST.c:372</a></div></div>
<div class="ttc" id="agroup__unitary_html_gad76781842af56821ed4e223bd776f057"><div class="ttname"><a href="group__unitary.html#gad76781842af56821ed4e223bd776f057">multiControlledPhaseFlip</a></div><div class="ttdeci">void multiControlledPhaseFlip(Qureg qureg, int *controlQubits, int numControlQubits)</div><div class="ttdoc">Apply the multiple-qubit controlled phase flip gate, also known as the multiple-qubit controlled paul...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00559">QuEST.c:559</a></div></div>
<div class="ttc" id="agroup__normgate_html_gae192ac0759e46c7b20a7182020155240"><div class="ttname"><a href="group__normgate.html#gae192ac0759e46c7b20a7182020155240">measureWithStats</a></div><div class="ttdeci">int measureWithStats(Qureg qureg, int measureQubit, qreal *outcomeProb)</div><div class="ttdoc">Measures a single qubit, collapsing it randomly to 0 or 1, and additionally gives the probability of ...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00743">QuEST.c:743</a></div></div>
<div class="ttc" id="astructVector_html_abc3cfc6c8e297b1153a373d84b981e6b"><div class="ttname"><a href="structVector.html#abc3cfc6c8e297b1153a373d84b981e6b">Vector::y</a></div><div class="ttdeci">qreal y</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00150">QuEST.h:150</a></div></div>
<div class="ttc" id="agroup__unitary_html_gab5828a9f0518951451d9fec9370199ae"><div class="ttname"><a href="group__unitary.html#gab5828a9f0518951451d9fec9370199ae">multiQubitUnitary</a></div><div class="ttdeci">void multiQubitUnitary(Qureg qureg, int *targs, const int numTargs, ComplexMatrixN u)</div><div class="ttdoc">Apply a general multi-qubit unitary (including a global phase factor) with any number of target qubit...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00295">QuEST.c:295</a></div></div>
<div class="ttc" id="astructVector_html_a0d0459a5b731ac5fb3dff2c6134e6e88"><div class="ttname"><a href="structVector.html#a0d0459a5b731ac5fb3dff2c6134e6e88">Vector::x</a></div><div class="ttdeci">qreal x</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00150">QuEST.h:150</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga0cbd92af48fe641522e62eea1a76a7c3"><div class="ttname"><a href="group__unitary.html#ga0cbd92af48fe641522e62eea1a76a7c3">compactUnitary</a></div><div class="ttdeci">void compactUnitary(Qureg qureg, const int targetQubit, Complex alpha, Complex beta)</div><div class="ttdoc">Apply a single-qubit unitary parameterised by two given complex scalars.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00403">QuEST.c:403</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga2f3bec8d06e7bf7314c581a5b837641f"><div class="ttname"><a href="group__unitary.html#ga2f3bec8d06e7bf7314c581a5b837641f">hadamard</a></div><div class="ttdeci">void hadamard(Qureg qureg, const int targetQubit)</div><div class="ttdoc">Apply the single-qubit Hadamard gate.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00175">QuEST.c:175</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga680f90d42e56950f40d11d695596a363"><div class="ttname"><a href="group__unitary.html#ga680f90d42e56950f40d11d695596a363">rotateY</a></div><div class="ttdeci">void rotateY(Qureg qureg, const int targetQubit, qreal angle)</div><div class="ttdoc">Rotate a single qubit by a given angle around the Y-axis of the Bloch-sphere.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00197">QuEST.c:197</a></div></div>
<div class="ttc" id="agroup__unitary_html_gadf4927a3d5dd8cd6d7400f2e810b4f05"><div class="ttname"><a href="group__unitary.html#gadf4927a3d5dd8cd6d7400f2e810b4f05">controlledNot</a></div><div class="ttdeci">void controlledNot(Qureg qureg, const int controlQubit, const int targetQubit)</div><div class="ttdoc">Apply the controlled not (single control, single target) gate, also known as the c-X,...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00523">QuEST.c:523</a></div></div>
<div class="ttc" id="agroup__type_html_ga8e1e6ad3254892edc2ee08712ea9d692"><div class="ttname"><a href="group__type.html#ga8e1e6ad3254892edc2ee08712ea9d692">destroyQureg</a></div><div class="ttdeci">void destroyQureg(Qureg qureg, QuESTEnv env)</div><div class="ttdoc">Deallocate a Qureg object representing a set of qubits.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00075">QuEST.c:75</a></div></div>
<div class="ttc" id="astructComplexMatrixN_html_a446e8a077597e4f76049d547df0c9738"><div class="ttname"><a href="structComplexMatrixN.html#a446e8a077597e4f76049d547df0c9738">ComplexMatrixN::real</a></div><div class="ttdeci">qreal ** real</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00139">QuEST.h:139</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga5a117f81298e8ed894d964198e737757"><div class="ttname"><a href="group__unitary.html#ga5a117f81298e8ed894d964198e737757">unitary</a></div><div class="ttdeci">void unitary(Qureg qureg, const int targetQubit, ComplexMatrix2 u)</div><div class="ttdoc">Apply a general single-qubit unitary (including a global phase factor).</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00347">QuEST.c:347</a></div></div>
<div class="ttc" id="astructQureg_html"><div class="ttname"><a href="structQureg.html">Qureg</a></div><div class="ttdoc">Represents a system of qubits.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00160">QuEST.h:160</a></div></div>
<div class="ttc" id="astructComplexMatrix2_html_a3ea98d545b67a190ee6abe936c72076f"><div class="ttname"><a href="structComplexMatrix2.html#a3ea98d545b67a190ee6abe936c72076f">ComplexMatrix2::real</a></div><div class="ttdeci">qreal real[2][2]</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00116">QuEST.h:116</a></div></div>
<div class="ttc" id="agroup__unitary_html_gaa854e4b76cfd4000a32c06c990960bd9"><div class="ttname"><a href="group__unitary.html#gaa854e4b76cfd4000a32c06c990960bd9">controlledCompactUnitary</a></div><div class="ttdeci">void controlledCompactUnitary(Qureg qureg, const int controlQubit, const int targetQubit, Complex alpha, Complex beta)</div><div class="ttdoc">Apply a controlled unitary (single control, single target) parameterised by two given complex scalars...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00416">QuEST.c:416</a></div></div>
<div class="ttc" id="agroup__debug_html_gaf8a14ae79c3fb2c0b5f6255cc37bebf9"><div class="ttname"><a href="group__debug.html#gaf8a14ae79c3fb2c0b5f6255cc37bebf9">reportQuESTEnv</a></div><div class="ttdeci">void reportQuESTEnv(QuESTEnv env)</div><div class="ttdoc">Report information about the QuEST environment.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00179">QuEST_cpu_distributed.c:179</a></div></div>
<div class="ttc" id="astructComplex_html_ab5b2e2eca02131fc74b289a83636cbe3"><div class="ttname"><a href="structComplex.html#ab5b2e2eca02131fc74b289a83636cbe3">Complex::real</a></div><div class="ttdeci">qreal real</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00105">QuEST.h:105</a></div></div>
<div class="ttc" id="agroup__type_html_ga3392816c0643414165c2f5caeec17df0"><div class="ttname"><a href="group__type.html#ga3392816c0643414165c2f5caeec17df0">createQureg</a></div><div class="ttdeci">Qureg createQureg(int numQubits, QuESTEnv env)</div><div class="ttdoc">Create a Qureg object representing a set of qubits which will remain in a pure state.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00034">QuEST.c:34</a></div></div>
<div class="ttc" id="agroup__calc_html_ga2a0fbd65f42d35dcd5ae966c48826920"><div class="ttname"><a href="group__calc.html#ga2a0fbd65f42d35dcd5ae966c48826920">calcProbOfOutcome</a></div><div class="ttdeci">qreal calcProbOfOutcome(Qureg qureg, const int measureQubit, int outcome)</div><div class="ttdoc">Gives the probability of a specified qubit being measured in the given outcome (0 or 1).</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00888">QuEST.c:888</a></div></div>
<div class="ttc" id="astructComplex_html_a84f5439aad0ef495efdd3b4c1c02d27e"><div class="ttname"><a href="structComplex.html#a84f5439aad0ef495efdd3b4c1c02d27e">Complex::imag</a></div><div class="ttdeci">qreal imag</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00106">QuEST.h:106</a></div></div>
<div class="ttc" id="astructComplex_html"><div class="ttname"><a href="structComplex.html">Complex</a></div><div class="ttdoc">Represents one complex number.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00103">QuEST.h:103</a></div></div>
<div class="ttc" id="agroup__type_html_ga8ba2c3388dd64d9348c3b091852d36d4"><div class="ttname"><a href="group__type.html#ga8ba2c3388dd64d9348c3b091852d36d4">createQuESTEnv</a></div><div class="ttdeci">QuESTEnv createQuESTEnv(void)</div><div class="ttdoc">Create the QuEST execution environment.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00129">QuEST_cpu_distributed.c:129</a></div></div>
<div class="ttc" id="agroup__unitary_html_gac5c485fe330636966effc0642ba2bd99"><div class="ttname"><a href="group__unitary.html#gac5c485fe330636966effc0642ba2bd99">rotateAroundAxis</a></div><div class="ttdeci">void rotateAroundAxis(Qureg qureg, const int rotQubit, qreal angle, Vector axis)</div><div class="ttdoc">Rotate a single qubit by a given angle around a given Vector on the Bloch-sphere.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00573">QuEST.c:573</a></div></div>
<div class="ttc" id="agroup__init_html_ga2f049055d4a51d0ea4d1a43b5234dedb"><div class="ttname"><a href="group__init.html#ga2f049055d4a51d0ea4d1a43b5234dedb">initZeroState</a></div><div class="ttdeci">void initZeroState(Qureg qureg)</div><div class="ttdoc">Initialise a set of  qubits to the classical zero state .</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00111">QuEST.c:111</a></div></div>
<div class="ttc" id="astructComplexMatrix2_html"><div class="ttname"><a href="structComplexMatrix2.html">ComplexMatrix2</a></div><div class="ttdoc">Represents a 2x2 matrix of complex numbers.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00114">QuEST.h:114</a></div></div>
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
</body>
        <script type="text/javascript" src="boot.js"></script>
</html>
